package com.coolingme.pool;

import java.sql.Connection;

/**
 * 连接池测试
 *
 * @author wangyue
 * @date 2020-09-16 23:37
 */
public class Test {

    public static void main(String[] args) {
        ConnectionPool connectionPool = new ConnectionPool();

        for (int i = 0; i < 8; i++) {
            // 获取连接
            Connection connection = connectionPool.getConnection();
            System.out.println("第" + (i + 1) + "个连接：" + connection);
            // 释放连接
            connectionPool.release(connection);
        }

        System.out.println("=========================================");

//        connectionPool.resetPool(2);

//        for (int i = 0; i < 4; i++) {
//            // 获取连接
//            Connection connection = connectionPool.getConnection();
//            System.out.println("第" + (i + 1) + "个连接：" + connection);
//            // 释放连接
//            connectionPool.release(connection);
//        }

    }

}
